﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using CSharpDesign.DAL;

namespace CSharpDesign.BLL
{
    public class DDSHService
    {
        SqlHelper data = new SqlHelper();
        public DataSet GetCodeBy(int iCount, string userName)
        {
            SqlHelper date = new SqlHelper();
            string strTop = "";
            if (iCount > 1)
            {
                strTop = "top " + iCount.ToString();
            }

            string sql = "select  " + strTop + "  * from [GouWuChe] where Ordeuser='" + userName + "' and OrderStite='待收货'   ";
            SqlConnection con = new SqlConnection(SqlHelper.connstring);
            SqlCommand cmd = new SqlCommand(sql, con);

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = null;
            try
            {
                con.Open();
                ds = new DataSet();
                da.Fill(ds);

            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
            return ds;
        }

    }
}